package com.itheima.dubbo.web;

import com.itheima.dubbo.fileUser;
import com.itheima.dubbo.pojo.User;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.rpc.RpcContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController {
    @DubboReference(version = "1.0.0")
    fileUser fileUser;

    @GetMapping("hello")
    public String hoell(String ss) {
        return fileUser.userId(ss);
    }

    @GetMapping("getid")
    public User userids(Integer id) {
        User user = new User();
        user.setId(id);
        RpcContext.getContext().setAttachment("itheima", user);
        return fileUser.users(user);


    }
}
